import Vue from 'vue'
import Router from 'vue-router'
import login from '@/view/login/login'
import layout from '@/view/layout/index.vue'
import test from '@/view/test/test'

Vue.use(Router)
const home = () => import('@/view/home/index.vue')
const admin = () => import('@/view/admin/index.vue')
const user = () => import('@/view/user/user')
const adminList = () => import('@/view/admin/adminList/index')
const userList = () => import('@/view/user/userList/index')
const authorList = () => import('@/view/user/authorList/index')
const tblabelList = () => import('@/view/user/tblabel/index')
const operationList = () => import('@/view/user/operationList/index')
const browsingHistoryList = () => import('@/view/user/browsingHistoryList/index')
const readList = () => import('@/view/user/readList/index')
const bookshelfList = () => import('@/view/user/bookshelfList/index')
const voideList = () => import('@/view/user/voideList/index')
const jurisdiction = () => import('@/view/jurisdiction/index')
const roleList = () => import('@/view/jurisdiction/roleList/index')
const permissionList = () => import('@/view/jurisdiction/permissionList/index')
const userRoleList = () => import('@/view/jurisdiction/userRoleList/index')
const rolePermissionList = () => import('@/view/jurisdiction/rolePermissionList/index')
const book = () => import('@/view/book/index')
const bookNameList = () => import('@/view/book/bookNameList/index')
const catalogueList = () => import('@/view/book/catalogueList/index')
const bookContentList = () => import('@/view/book/bookContentList/index')
const discuss = () => import('@/view/discuss/index')
const bookDiscussList = () => import('@/view/discuss/bookDiscussList/index')
const bookFragmentDiscussList = () => import('@/view/discuss/bookFragmentDiscussList/index')
const carte = () => import('@/view/carte/index')
const carteList = () => import('@/view/carte/carteList/index')
const bookList = () => import('@/view/carte/booklist/index')
const navigationList = () => import('@/view/carte/navigationList/index')

const routes = [
  {
    path: '/',
    component: layout,
    children: [
      {
        path: '/',
        name: home,
        component: home,
      },
      {
        path: '/admin',
        name: admin,
        component: admin,
        children: [{
          path: 'admin-list',
          component: adminList
        }]
      },
      {
        path: '/user',
        name: user,
        component: user,
        children: [{
          path: 'user-list',
          component: userList,
        },{
          path: 'author-list',
          component: authorList,
        },{
          path: 'tblabel-list',
          component: tblabelList,
        },{
          path: 'read-list',
          component: readList,
        },{
          path: 'bookshelf-list',
          component: bookshelfList,
        },{
          path: 'operation-list',
          component: operationList,
        },{
          path: 'browsingHistory-list',
          component: browsingHistoryList,
        },{
          path: 'voide-list',
          component: voideList,
        }]
      },{
        path: '/jurisdiction',
        name: jurisdiction,
        component: jurisdiction,
        children: [{
          path: 'permission-list',
          component: permissionList,
        },{
          path: 'role-list',
          component: roleList,
        },{
          path: 'user-role',
          component: userRoleList
        },{
          path: 'role-permission',
          component: rolePermissionList
        }]
      },{
        path: '/book',
        name: book,
        component: book,
        children: [{
          path: 'bookName-list',
          component: bookNameList,
        },{
          path: 'catalogue-list',
          component: catalogueList,
        },{
          path: 'bookContent-list',
          component: bookContentList,
        }]
      },{
        path: '/discuss',
        name: discuss,
        component: discuss,
        children: [{
          path: 'bookDiscuss-list',
          component: bookDiscussList,
        },{
          path: 'bookFragmentDiscuss-list',
          component: bookFragmentDiscussList,
        }
        // ,{
        //   path: 'bookContent-list',
        //   component: bookContentList,
        // }
        ]
      },{
        path: '/carte',
        name: carte,
        component: carte,
        children: [{
          path: 'carte-list',
          component: carteList,
        },{
          path: 'book-list',
          component: bookList,
        },{
          path: 'navigation-list',
          component: navigationList,
        }]
      }]
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/test',
    name: 'test',
    component: test
  },
]

const router = new Router({
  routes
})

export default router
